/**
 * Created by karl.zheng on 2018/1/8.
 */
import React from 'react'
import { render } from 'react-dom'
import { createStore } from 'redux'
import { Provider } from 'react-redux'
import reducer from './reducers'
import { Router, hashHistory } from 'react-router'
import routeConfig from './router'
import { store } from './config/requires'
import { resize } from './config/requires'
import 'reset.css'



import { Button, ButtonGroup } from 'rsuite'
import './base.scss'
import 'rsuite/dist/styles/rsuite.min.css'

class Buttons extends React.Component {
	constructor(props) {
		super(props)
	}

	render() {
		return <div className="buttons row">
			<ButtonGroup>
				<Button appearance="primary" onClick={this.Login}> 登录</Button>
				<Button appearance="primary" onClick={this.BindZone}>绑定区服</Button>
				<Button appearance="primary" onClick={this.Pay}>支付</Button>
				<Button appearance="primary" onClick={this.Logout}>退出</Button>
				<Button appearance="primary" onClick={this.share}>分享</Button>
			</ButtonGroup>
		</div >
	}

	share() {

	}

	Login() {
		SDK.Login2();
	}

	BindZone() {
		var data = {
			userId: 25086659,
			gameZoneId: 1,
			createRole: 0,
			roleId: 123,
			level: 1
		}
		SDK.BindZone(data);
	}

	Pay() {
		var data = {
			userId: 25086659,
			gameOrderId: Math.floor(Math.random() * 100000000),//假设的订单id
			gameZoneId: 1,
			roleId: 1001,
			roleName: "karl",
			level: 12,
			gameCoin: 100
		}
		SDK.Pay(data);
	}

	Logout() {
		SDK.Logout();
	}

}

render(
	<div>
		<Provider store={store} >
			<Router routes={routeConfig} history={hashHistory} />
		</Provider>
		<Buttons />
	</div>,
	document.getElementById('sdk')
)



